<template>
	<div>
		<div>
			<!-- <el-form :inline="true" class="demo-form-inline">
				<el-form-item class="lh" label=""><el-input placeholder="文章标题"></el-input></el-form-item>
				<el-form-item class="lh" label=""><el-date-picker type="date" format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="发布时间"></el-date-picker></el-form-item>
			</el-form> -->
		</div>
		<div>
			<el-table :data="this.tableData" style="width: 100%">
				<el-table-column prop="article_id" label="文章ID">
					<!-- <template slot-scope="scope">
						
						<router-link to="/loginZJ/neirongZJ">{{ article_id }}</router-link>
					</template> -->
				</el-table-column>
				<el-table-column prop="c_content" label="评论内容" width="300"></el-table-column>
				<el-table-column prop="create_date" label="评论日期" width="300"></el-table-column>
				<el-table-column prop="" label="操作" width="100">
					<template slot-scope="scope">
						<el-button type="text" size="small" @click="sc(scope.row.c_id)">删除</el-button>
					</template>
				</el-table-column>
			</el-table>
		</div>
	</div>
</template>

<script>
export default {
	inject:['reload'],
	name: 'wdplZJ',
	data() {
		return {
			id: '',
			tableData: []
		};
	},
	mounted() {
		let that = this;
		// (this.id = this.$route.query.id),
		this.id = localStorage.getItem('id');
		this.$axios
			.post('http://localhost:8080/selectdat/DataComment', this.$qs.stringify({ expert_id: this.id }))
			.then(function(response) {
				// console.log(response.data[0].c_id);
				for (var a = 0; a < response.data.length; a++) {
					that.tableData.push(response.data[a]);
				}
			})
			.catch(function(error) {
				console.log(error);
			});
	},

	methods: {

		sc(a) {
			
			let that = this;
			// alert(a);
			if(confirm("是否删除")){
				this.$axios
					.post('http://localhost:8080/comment/DelectCommernt', this.$qs.stringify({ c_id: a }))
					.then(function(response) {
						alert(response.data);
						that.reload();
					})
					.catch(function(error) {
						console.log(error);
					});
				
			}
		
			// console.log(response.data[0].c_id);
				
		},
	}
};
</script>

<style scoped lang="less">
.demo-form-inline {
	width: 100%;
	height: 60px;
	.lh {
		margin-top: 10px;
	}
}
</style>
